<!DOCTYPE html>
<html>
<div th:replace="common/jsCssRef :: jsfJsCssRef"></div>
<body class="bgf6">

	<div th:replace="common/head :: jsfHeader"></div>
	
	<div class="main-body pb100">
		<div class="container pt10">
			<div class="dflx sbt">
				<div th:replace="common/left :: jsfLeft"></div>
				
				<div class="body-right" >
					<div class="bread-nav bgff">
						<ul class="dflx">
						</ul>
					</div>
					
					<div class="bgff mt10 pb20 edit-mode">
						<div class="wrap">
							
                            <div class="box">
                            	<div class="box-title"><span>学校基本信息</span></div>
                            	<div class="mt20 f14">
                            		<div class="two">
                            			<span class="title">学校名称</span>
	                					<div class="content">
	                						<input type="text" id="areaName" class="form-control" value="" placeholder="请输入学校名称"/>
	                					</div>
	                        			<span class="title">经度</span>
	                					<div class="content">
	                						<input type="text" id="lon" class="form-control" value="" placeholder="请输入学校经度"/>
                						</div>
                            		</div>

                					<div class="two">
                						<span class="title">纬度</span>
	                					<div class="content">
	                						<input type="text" id="lat" class="form-control" placeholder="请输入学校纬度" value="" />
	                					</div>
                					</div>
                					
                            	</div>
                            </div>
                            
                            <div class="tc mt40">
                            	<button type="button" class="btn btn-white f12"> 取消 </button>
								<button type="button" class="btn btn-white f12" onclick="savePlan()"> 保存 </button>
                            </div>
							
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
	

<script type="text/javascript">

    $(document).ready(function () {
        $('#areaLi').addClass('active');
    });

    var appPage = new Vue({
        el : '#app',
        data : {
            plan : {}
        },
        created : function() {
        },
        methods : {

        }
    })


	function savePlan() {
	    var params = {
	        'areaName' : $('#areaName').val(),
	        'lat' : $('#lat').val(),
	        'lon' : $('#lon').val()
		}

		if ($('#areaName').val() == '') {
			alert('请输入学校名称');
			return;
		}
        if ($('#lat').val() == '') {
            alert('请输入学校纬度');
            return;
        }
        if ($('#lon').val() == '') {
            alert('请输入学校经度');
            return;
        }

        $.ajax({
            'url' : '/admin/addArea',
            'dataType' : 'json',
            'type' : 'post',
            'data' : params,
            'success' : function (result) {
                if (result.code != 1000) {
                    alert(result.msg);
                    if (result.code == 5555) {
                        window.location.href = '/';
                    }
                    return;
                }

                appPage.$message({
                    type: 'info',
                    message: '保存成功'
                });

                window.location.href = '/view/area';
            },
            'error' : function (result) {
            }
        });

		
    }

</script>
</body>
</html>
